import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { IndexComponent } from './index.component';
import { PostComponent } from './post/post.component';
import { PostDetailComponent } from './post-detail/post-detail.component';
import { PictureComponent } from './picture/picture.component';
import { VideoComponent } from './video/video.component';


@NgModule({
    imports: [
        RouterModule.forChild([
            {
                path: 'index',
                component: IndexComponent,
                children: [
                    {
                        path: '',
                        component: PostComponent,
                        children: [
                            { path: '', redirectTo: 'post', pathMatch: 'full' }
                        ]
                    },
                    {
                        path: 'post',
                        component: PostComponent, //Lazy load main module
                        data: { preload: true }
                    },
                    {
                        path: 'postdetail/:id',
                        component: PostDetailComponent, //Lazy load admin module
                        data: { preload: true }
                    },
                    {
                        path: 'picture', component: PictureComponent
                    },
                    {
                        path: 'video', component: VideoComponent
                    },
                    {
                        path: '**', redirectTo: 'post'
                    }
                ]
            }
        ])
    ],
    exports: [RouterModule]
})
export class IndexRoutingModule { }
